package com.smartum.mpr.client.services;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import com.smartum.mpr.shared.User;

/**
 * Marker interface for {@link com.smartum.mpr.server.UserServiceImpl}.
 */
@RemoteServiceRelativePath("userService")
public interface UserService extends RemoteService {

    /**
     * Returns {@link User} with neccessary information if user exists, and user with <code>message</code> field otherwise.
     *
     * @param username
     * @param userPassword
     * @return User with name, id and token or message
     */
    User retrieveUser(String username, String userPassword);

    /**
     * Return {@link User} with necessary information from {@link javax.servlet.http.HttpSession} after login action.
     * <p/>
     * Method prevent coupling of the widgets.
     *
     * @return User with name, id and token
     */
    User retrieveUserFromSesion();

    /**
     * Cleanup {@link javax.servlet.http.HttpSession} after logout action.
     */
    void logout();
}
